import math

MAX_DIFFVAL = 1000.0

def pick_letter(alphabet, directions, output):
    min_diff = MAX_DIFFVAL
    letter = None

    for a in xrange(len(alphabet)):
        norm_diff = 0.0

        for i in xrange(len(output)):
            diff = directions[a][i] - output[i]
            norm_diff += diff * diff
        norm_diff = math.sqrt(norm_diff)

        if norm_diff < min_diff:
            letter = alphabet[a]
            min_diff = norm_diff

    return letter

